<template>
  <div class="aside">
    <el-row class="tac">
      <el-col :span="24">
        <h3>
          <router-link to="/">小U商城后台</router-link>
        </h3>
        <!-- default-active	当前激活菜单的 index -->
        <!-- router 是否开启路由模式，开启后会以index作为路径跳转 -->
        <el-menu
          router
          :default-active="$route.path"
          class="el-menu-vertical-demo"
          background-color="rgb(38,42,50)"
          text-color="#fff"
          active-text-color="#ffd04b"
        >
          <el-menu-item index="/">
            <i class="el-icon-setting"></i>
            <span slot="title">首页</span>
          </el-menu-item>
          
          <el-submenu v-for="(item) in myMenus" :key="item.id" :index="String(item.id)">
            <template slot="title">
              <!-- icon组件，类名控制内容 -->
              <i :class="item.icon"></i>
              <span>{{item.title}}</span>
            </template>
              <el-menu-item :index="item1.url" v-for="item1 in item.children" :key="item1.id">{{item1.title}}</el-menu-item>
              <!-- <el-menu-item index="/role">角色管理</el-menu-item>
              <el-menu-item index="/admin">管理员管理</el-menu-item> -->
          </el-submenu>
          <!-- <el-submenu index="1">
            <template slot="title">
              icon组件，类名控制内容
              <i class="el-icon-setting"></i>
              <span>系统设置</span>
            </template>
              <el-menu-item index="/menu">菜单管理</el-menu-item>
              <el-menu-item index="/role">角色管理</el-menu-item>
              <el-menu-item index="/admin">管理员管理</el-menu-item>
          </el-submenu> -->
        </el-menu>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import {mapGetters,mapMutations} from 'vuex'
export default {
  computed:{
    ...mapGetters(['myMenus'])
  },
  methods: {
    ...mapMutations(['clearUserInfo'])
  },
};
</script>
<style scoped>
 .el-menu{
   /* overflow-x: hidden; */
   border-right: none;
 }

 h3{
   background-color: rgb(68,68,68);
   text-align: center;
   height: 50px;
   line-height: 50px;
 }
 h3 a{
   text-decoration: none;
   color: white;
 }
</style>